import type { AxiosResponse } from "axios";

/*
  axios响应返回值：
    {
      config: xxx,
      data: xxx,
      headers: xxx,
      status: xxx
    }

    整体类型属于：AxiosResponse

    export interface AxiosResponse<T = any, D = any> {
      data: T;
      status: number;
      statusText: string;
      headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
      config: InternalAxiosRequestConfig<D>;
      request?: any;
    }

    data：
      {
        code: 200,
        message: '',
        success: true,
        data: xxx
      }

    定义类型 ResponseDataType

      interface ResponseDataType<T> {
        code: number;
        message: string;
        success: boolean;
        data: T;
      }
*/

interface ResponseDataType<T> {
  code: number;
  message: string;
  success: boolean;
  data: T;
}

export type ResponseType<T> = AxiosResponse<ResponseDataType<T>>;

export interface TodoItem {
  id: number;
  name: string;
  isDone: boolean;
}

export type TodoList = TodoItem[];
